Send feedback on this topic.
Teradata.Client.Provider
GetBytes(Int32,Int64,Byte[],Int32,Int32) Method



Teradata.Client.Provider Namespace > TdDataReader Class > GetBytes Method : GetBytes(Int32,Int64,Byte[],Int32,Int32) Method
Column ordinal (see TdDataReader.GetOrdinal).
The index within the field from which to begin the read operation.
The buffer into which to copy the field.
The index for the buffer to begin the copy operation.
The maximum length to copy into the buffer.
Gets the value of the specified field (column) as a byte array.
Syntax
'Declaration
 
Public Overloads Overrides NotOverridable Function GetBytes( _
   ByVal ordinal As Integer, _
   ByVal dataOffset As Long, _
   ByVal buffer() As Byte, _
   ByVal bufferOffset As Integer, _
   ByVal length As Integer _
) As Long
'Usage
 
Dim instance As TdDataReader
Dim ordinal As Integer
Dim dataOffset As Long
Dim buffer() As Byte
Dim bufferOffset As Integer
Dim length As Integer
Dim value As Long
 
value = instance.GetBytes(ordinal, dataOffset, buffer, bufferOffset, length)
public override long GetBytes( 
   int ordinal,
   long dataOffset,
   byte[] buffer,
   int bufferOffset,
   int length
)
public:
int64 GetBytes( 
   int ordinal,
   int64 dataOffset,
   array<byte>^ buffer,
   int bufferOffset,
   int length
) override 

Parameters

ordinal
Column ordinal (see TdDataReader.GetOrdinal).
dataOffset
The index within the field from which to begin the read operation.
buffer
The buffer into which to copy the field.
bufferOffset
The index for the buffer to begin the copy operation.
length
The maximum length to copy into the buffer.

Return Value

Returns the number of bytes read and stored into the buffer.
Exceptions
ExceptionDescription
dataOffset is less than zero or length is less than zero or bufferOffset is less than zero or bufferOffset is greater than buffer length.
ordinal is less than zero or ordinal is equal to or greater than TdDataReader.FieldCount.
The field cannot be converted into System.Byte. A null field will result in an exception.
CommandBehavior is set to SchemaOnly, or there is no data for the row or column, or preceding columns are no longer accessible.
The TdDataReader is closed.
The Advanced SQL Engine returned an error, or .NET Data Provider for Teradata detected an error.
Remarks

Use this method to retrieve columns of type BYTE, VARBYTE or BLOB. GetBytes method supports the concept of chunking. Applications can call GetBytes method to retrieve the field in smaller manageable chunks. For example a 10 MB BLOB field can be retrieved in 32KB chunks. The number of bytes copied into the buffer can be less than the length specified.

A null buffer reference should be passed to retrieve the size of the field, as opposed to the maximum size of the column retrieved using the GetSchemaTable method.

Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdDataReader Class
TdDataReader Members
Overload List